package org.yxjme.ijkplayerlibrary.android;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import org.yxjme.ijkplayerlibrary.R;


/**
 *
 * 音量变化view
 *
 */
public class ChangeVolumeView extends LinearLayout {

    private ProgressBar volumeProgressBar ;

    public ChangeVolumeView(Context context) {
        this(context,null);
    }

    public ChangeVolumeView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public ChangeVolumeView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setOrientation(HORIZONTAL);
        addChildViews();
    }

    /**
     * 添加子view
     */
    private void addChildViews() {
        View view = LayoutInflater.from(getContext()).inflate(R.layout.change_volume_layout,this,false);
        addView(view);
        volumeProgressBar = view.findViewById(R.id.volumeProgressBar);
    }


    /**
     * 设置当前音量进度
     *
     * @param progress
     */
    public void setProgressVolume(int progress){
        volumeProgressBar.setProgress(progress);
    }

}
